/** @file               sw_tls.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 417 $
 *  @date               $Date: 2017-01-08 21:27:13 +0800 (周日, 08 1月 2017) $
 */
#ifndef __SW_TLS_H__
#define __SW_TLS_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef SW_VOID         *SW_TLS;
#define SW_INVALID_TLS  NULL

typedef SW_RET (*SW_TLS_DTOR)(SW_VOID *pValue);

SW_API SW_RET SW_InitTlsAPI(SW_VOID);
SW_API SW_RET SW_RunTlsAPI(SW_VOID);
SW_API SW_RET SW_StopTlsAPI(SW_VOID);
SW_API SW_RET SW_ExitTlsAPI(SW_VOID);
SW_API SW_TLS SW_CreateTls(SW_TLS_DTOR dtor);
SW_API SW_RET SW_DeleteTls(SW_TLS tls);
SW_API SW_RET SW_SetTlsValue(SW_TLS tls, const SW_VOID *pValue);
SW_API SW_VOID *SW_GetTlsValue(SW_TLS tls);
SW_API SW_RET SW_CleanupTls(SW_VOID);

#ifdef __cplusplus
}
#endif

#endif
